//
//  StrategyCollectionCell.m
//  XhlTrip
//
//  Created by dllo on 15/8/24.
//  Copyright (c) 2015年 蓝鸥科技. All rights reserved.
//

#import "StrategyCollectionCell.h"
#import "StrategyModel.h"
#import "UIImageView+WebCache.h"

@implementation StrategyCollectionCell
- (instancetype)initWithFrame:(CGRect)frame
{
    if (self) {
        self = [super initWithFrame:frame];
       
        
        
       
        self.cellImage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.cellImage];
        [_cellImage release];
        
        self.nameLabel = [[UILabel alloc] init];
        _nameLabel.textColor = [UIColor whiteColor];
        _nameLabel.font = [UIFont fontWithName:@"Verdana-BoldItalic" size:19 * Width];
        [self.cellImage addSubview:self.nameLabel];
        [_nameLabel release];
        
        self.EnLabel = [[UILabel alloc] init];
        _EnLabel.font = [UIFont fontWithName:@"Verdana-BoldItalic" size:14 * Width];
        _EnLabel.textColor = [UIColor whiteColor];
        [self.cellImage addSubview:self.EnLabel];
        [_EnLabel release];
        
        self.contLabel = [[UILabel alloc] init];
        _contLabel.textAlignment = NSTextAlignmentCenter;
        _contLabel.backgroundColor = [UIColor blackColor];
        _contLabel.alpha = 0.6;
        _contLabel.textColor = [UIColor whiteColor];
        _contLabel.font = [UIFont fontWithName:@"Verdana-BoldItalic" size:14 * Width];
        [self.cellImage addSubview:self.contLabel];
        [_contLabel release];
        

    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
   
    self.cellImage.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height);
    
    self.nameLabel.frame = CGRectMake(10 * Width, 10 * Height, 150 * Width, 30 * Height);
    self.EnLabel.frame = CGRectMake(10 * Width, 33 * Height, 150 * Width, 30 * Height);
    self.contLabel.frame = CGRectMake(40 * Width, self.frame.size.height - 40 * Height, 90 * Width, 25 * Height);
    
    
}


- (void)setStrategyModel:(StrategyModel *)strategyModel
{
    if (_strategyModel != strategyModel) {
        [_strategyModel release];
        _strategyModel = [strategyModel retain];
    }
    [_cellImage  sd_setImageWithURL:strategyModel.image_url];
    _nameLabel.text = strategyModel.name_zh_cn;
    _EnLabel.text = strategyModel.name_en;
    _contLabel.text = [NSString stringWithFormat:@"%@%@", [strategyModel.poi_count stringValue], @"旅行地"];
}

- (void)dealloc
{
    [_strategyModel release];
    [_nameLabel release];
    [_EnLabel release];
    [_contLabel release];
    [_cellImage release];
    [super dealloc];
}
@end
